#include "game.h"
#include "game_status.h"

Game::Game()
{
    this->gameStatus = new GameStatus();
    this->background = new BackGround();
    this->character = new Character();
}

Game::~Game()
{
    delete background;
}

void Game::Run()
{
    this->gameStatus->UpdateStatusData(GameStatusData{.cltp = this->character->GetLTP(),
                                                      .clbp = this->character->GetLBP(),
                                                      .crtp = this->character->GetRTP(),
                                                      .crbp = this->character->GetRBP(),
                                                      .cbmp = this->character->GetBMP()});
    this->PollEvents();
    this->Draw();
}

void Game::PollEvents()
{
    this->background->EventHandler(this->gameStatus);
    this->character->EventHandler(this->gameStatus);
}

void Game::Draw()
{
    this->background->Draw();
    this->character->Draw();
}
